details widget name

Export and import

Same cat chapters
  • Technical documentation: Others
Chapter details

The Atlas import and export functionalities allow the reusing of important system entities such as widgets, content types and even whole sites.

Export.

When exporting an Atlas business object, it is converted to xml format and packaged to a zip archive together with all required related entities. For example, a content type is packaged with all its properties, property bundles, etc. Each entity which is exportable should supply an adapter service, which provides an instance of the IExportProvider interface. The latter has a single method:

public void appendContentToPackage( IPackage pack, IBean< ? extends IProxy > bean );

This method converts the bean entity to xml format and adds it to the package entity. To summarize, the package is actually a set of xml files, which describe the business objects representing the exported business object. After the export process is completed, the archieved entity is stored in the database.

Import.

The import works in a manner opposite to the export, described above. The zipped entity is retrieved from the database and its content is unpacked. Afterwards, a package is created from the retrieved xml files. Similar to the export functionality, there should be an instance of the IImportProvider interface for every entity, which allows import. The interface has one method:

public IBean< ? extends IProxy > importBean( IPackage pack, String beanUuid, Map< String, Object > additionalProperties );

The method uses the beanUuid parameter in order to find the xml file, which describes the given business object. All required xml files are stored in the IPackage entity. Every component defines a specific xml parser, which is used to convert the xml to an Atlas entity. Finally, the newly created object is stored in the database.

The export/import functionality is particularly valuable, because of the system domain structure. Each Atlas installation has a so called admin domain. In the scope of the described functionality, the admin domain serves as a repository for exported packages. All other domains in the system are allowed to import from the set of packages in the admin domain. Moreover, each domain is allowed to contribute packages to the admin domain. A package should be approved by a system administrator in order for it to be 'published' in the admin domain.

Important classes:

Package – provides access to all xml files, which are included in the export/import of a business object. It also includes helper methods to ease the usage of the export/import functionalities.

AXmlProvider – an abstract parent class, which allows for an entity to be converted to xml format. There are specific xml providers for each exportable Atlas entity.

AEntityXmlFile – an abstract parent class for the xml entities used with this functionality. The class provides access to the name and content of the given xml file. Each exportable entity in the system provides its own implementation of the AEntityXmlFile.

AentityXmlParser – converts an xml file to an Atlas business object.

EntityXmlHelper – provides helper methods, which allow the loading of an entity specific xml file based on a bean identifier.

Important services:

IPackageService – provides all methods, related to the export/import functionalities such as: convert Atlas entity to xml, create Atlas entity from xml, save zipped archive to database, load and unpack zipped archive.